clear all;close all;clc
load pc_all_freq_EEG PC_all
f1=figure;
titles={'Subjects 1-8','Subjects 9-16'};
Sca1=0.275;
Sca2=0.09;
shifts = [-Sca1 -Sca2 Sca2 Sca1]
for ip = 1:2
    subplot(2,1,ip)
    plotthis = PC_all((ip-1)*8+(1:8),:);
    pp=bar(plotthis.*100);
    MM=legend(pp(1:4),'SCP','Mu','Beta','Gamma','Location','NorthEastOutside');
    MM.AutoUpdate = 'off';
    hold on;
    for imode = 1:4
        for isubject=1:8
            CI(isubject) = f_confid_I(20*20*5,plotthis(isubject),0.05);
            if plotthis(isubject,imode)-CI(isubject)>0.2
                t=text(isubject+shifts(imode),100*(plotthis(isubject,imode)+CI(isubject)+0.03),'*');
                set(t,'HorizontalAlignment','center','fontsize',14)
            end
        end
        errorbar((1:8)+shifts(imode),plotthis(:,imode).*100,CI.*100,'.k')
    end

    plot([0.5 8.5],[20 20],'k');
    xlim([0.5 8.5])

    ylim([0 100])
    box off
    xlabel('Subject')
    title(titles{ip})
end
set(gca,'xticklabel',9:16)
ylabel('Accuracy (%)')
exportgraphics(f1,'Figure11.png','Resolution',300);

